package com.credit.util;

import java.util.UUID;
import java.util.concurrent.TimeUnit;

import com.credit.entity.CreditUserInfo;
import com.credit.service.RedisService;

public class TokenUtil {
	
	
	public static String getToken(CreditUserInfo userInfo){
		
		String token = UUID.randomUUID().toString().toLowerCase().replaceAll("-", "");
		
		RedisService redisService = (RedisService) ApplicationContextUtils.getBean("redisService");
		
		redisService.setValueDefaultNull(token, userInfo.getId(),30,TimeUnit.DAYS);
		
		return token;
	}

}
